#include<iostream>
#include<string>

using namespace std;
void reverse(string& str)
{
    char ch = str[0];
    str.erase(str.begin());
    str.push_back(ch);
}

int main()
{
    string str;
    int n = 0;
    cin >> str;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        reverse(str);
        cout << str << endl;
    }
    return 0;
}